#include <list>

using namespace std;

int dis(int a, int b){
	if(a * b > 0)
		return a - b > 0 ? a - b : b - a;
	else
		return a + b > 0 ? a + b : (a + b) * -1;
}

int* func(int arr[], int size, int &length){
	if(size <= 2){
		length = 1;
		return new int(arr[0]);
	}

	int sum = 0;
	for(int i = 0; i < length; ++i)
		sum += arr[i];

	int *result = new int[size];
	int index = 0;
	for(int i = 1; i < length; ++i){
		for(int j = 0; j < length; ++j)
			if(i == result[j])
				break;
		if(dis(arr[index], sum / 2) > dis(arr[i], sum /2)){
			index = i;
		}
	}

	return NULL;
}